<?php
include_once '../comm/config.php';  
include '../comm/checkpostandget.php';
header("Content-type:text/html;charset=utf-8"); 
if($_POST['uname']!=''){
    $sql="select Id,ddusername,email,ddpassword,jihuo from ".$BIAOTOU."user where ddusername='".$_POST['uname']."' limit 1";
	$query=mysql_query($sql);
	$arr=mysql_fetch_array($query);
	$email=$arr['email'];
	$jihuo=$arr['jihuo'];
	$uid=$arr['Id'];
	$name=$arr['ddusername'];
	$md5pwd=$arr['ddpassword'];
	$e=$email;
	if($uid>0 && $jihuo==0){
		$jihuo_code=urlencode(base64_encode($uid.'#'.$name.'#'.$md5pwd));
		$jihuo_url='http://'.URL.'/user/savereg.php?jihuo='.$jihuo_code;
	    $msg_zhuce='您的网站激活链接<a href='.$jihuo_url.'>'.$jihuo_url.'</a>';
		mail_send($email, WEBTITLE.'欢迎您的到来', $msg_zhuce);
	}
	elseif(!$uid){
	    echo "<script language=javascript>alert('账号不存在，请从新输入！');window.history.go(-1);</script>"; 
	    exit;
	}
	elseif($jihuo==1){
	    echo "<script language=javascript>alert('此账号无需激活，可直接登陆！');window.location='login.php';</script>"; 
	    exit;
	}
}
elseif($_GET['e']!=''){
    $e=$_GET['e'];
}

if($e!=''){
    $row=explode('@',$e);
    $web='http://mail.'.$row[1];
}

$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>激活账号 - 用户中心</title>
<link href="../css/usercss.css" rel="stylesheet" type="text/css">
<link href="../template/<?=MOBAN?>/css/common.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<?php
include("../template/".MOBAN."/header.tpl.php");
?>
<?php
include("../template/".MOBAN."/nav.tpl.php");
?> 
<div id="maincenter">
  <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="50" align="left">&nbsp;</td>
  </tr>
  <tr>
    <td height="50" align="center"><img src="../images/step.gif" width="637" height="31" /></td>
  </tr>
  <tr>
    <td height="50" align="center"><div style="font-size:14px">恭喜您注册成功，我们已经向您的邮箱发送了注册激活邮件，请登陆<a style="font-size:16px; color:#03F" href="<?=$web?>">邮箱</a>激活您的账号。</div></td>
  </tr>
</table>
</div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
mysql_close();
?>
</body>
</html>